package com.newlink.building.userinfo.mvp.model

import com.newlink.building.common_base.base.BaseModel
import com.newlink.building.common_base.http.Base_RetrofitHelper
import com.newlink.building.common_base.model.bean.*
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_AuthFaceContract
import io.reactivex.Observable

/**
 * @author wangyang
 * @date 2022/9/20
 * @description 我的——关于页面的Model
 */
class Module_UserInfo_AuthFaceModel : BaseModel(), Module_UserInfo_AuthFaceContract.Model {
    override fun getFaceData(request: LoadFaceListDataRequest): Observable<HttpResult<FaceListData>> {
        return Base_RetrofitHelper.service.getAuthKeyList(request.accessToken, AuthKeyTypeFace)
    }

    override fun removeFaceData(request: DeleteFaceDataRequest): Observable<HttpResult<StatusData>> {
        return Base_RetrofitHelper.service.deleteAuthKey(request.accessToken, request.data.keyId)
    }

    override fun uploadFaceData(request: UploadFaceDataRequest): Observable<HttpResult<StatusData>> {
        return Base_RetrofitHelper.service.addAuthKey(request.accessToken, request.data)
    }

    override fun checkFaceValid(token: String, mBase64: String): Observable<HttpResult<Boolean>> {
        val bean = FaceInfoBean(mBase64)
        return Base_RetrofitHelper.service.checkFaceValid(token, bean)
    }

}